<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"  xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:replace="_header_include::frag(~{::title},~{::style},~{})">
    <title>后台管理系统</title>
    <style>
        button a{color:#fff!important;}
    </style>
</head>
<body>
<div id="clueManage" class="clueManage mainPadding" style="display: none;">
    <el-breadcrumb separator="/" class="elBreadcrumb marginB20">
        <el-breadcrumb-item>Home</el-breadcrumb-item>
        <el-breadcrumb-item>电销管理</el-breadcrumb-item>
        <el-breadcrumb-item>待分配新资源</el-breadcrumb-item>
    </el-breadcrumb>

    <el-row class="marginB20">
        <el-button type="primary" @click="dialogFormVisible = true"><i class="el-icon-menu"></i>选择列</el-button>
        <shiro:hasPermission name="aggregation:pendingAllocationManager:allocation">
            <el-button type="success" @click="toAllocationClue">分配资源</el-button>
        </shiro:hasPermission>
        <shiro:hasPermission name="aggregation:pendingAllocationManager:transfer">
            <el-button type="warning" @click="toTransferClue">转移资源</el-button>
        </shiro:hasPermission>
        <!-- <shiro:hasPermission name="aggregation:pendingAllocationManager:batch">
            <el-button type="warning" @click="toBatchClue">批量分发</el-button>
        </shiro:hasPermission> -->
        <shiro:hasPermission name="aggregation:pendingAllocationManager:ceo">
            <el-button type="danger" @click="toCeoClue">副总分发</el-button>
        </shiro:hasPermission>
    </el-row>
    <div class="mainSearchBg">
        <div class="mainSearchFormBox">
            <el-form :inline="true" :model="clueSearchForm" class="demo-form-inline mainSearchForm" ref="clueSearchForm">
                <el-form-item label="客户手机号:" prop="phone">
                    <el-input v-model="clueSearchForm.phone" placeholder="客户手机号" class="input-with-select"></el-input>
                </el-form-item>
                <el-form-item label="资源类别:" prop="category">
                    <el-select v-model="clueSearchForm.category" clearable filterable placeholder="资源类别">
                      <el-option
                          v-for="item in categoryOptions"
                          :key="item.value"
                          :label="item.name"
                          :value="item.value">
                      </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="电销组:" prop="teleGorupId">
                    <el-select v-model="clueSearchForm.teleGorupId" clearable placeholder="电销组" style="width: 100%;" :disabled="isDXZDisabled">
                      <el-option
                	      v-for="item in teleGorupOptions"
                	      :key="item.id"
                	      :label="item.name"
                	      :value="item.id">
                	  </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="创建时间:">
                    <el-date-picker format="yyyy-MM-dd HH:mm:ss" v-model="clueSearchForm.startTime" type="datetime" placeholder="选择日期"></el-date-picker>
                </el-form-item>
                <el-form-item label="—" class="widthauto">
                    <el-date-picker format="yyyy-MM-dd HH:mm:ss" v-model="clueSearchForm.endTime" type="datetime" placeholder="选择日期"></el-date-picker>
                </el-form-item>
                <el-row v-show="isShow">
                    <el-form-item label="资源类型:" prop="type">
                        <el-select v-model="clueSearchForm.type" clearable placeholder="资源类型" style="width: 100%;">
                            <el-option
                                    v-for="item in typeOptions"
                                    :key="item.value"
                                    :label="item.name"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
        		    <el-form-item label="客户姓名:" prop="cusName">
                        <el-input v-model="clueSearchForm.cusName" placeholder="客户姓名" class="input-with-select"></el-input>
                    </el-form-item>
                    <el-form-item label="留言重点:" prop="messagePoint">
                        <el-input v-model="clueSearchForm.messagePoint" placeholder="留言重点" class="input-with-select"></el-input>
                    </el-form-item>
                    <el-form-item label="搜索词:" prop="searchWord">
                        <el-input v-model="clueSearchForm.searchWord" placeholder="搜索词" class="input-with-select"></el-input>
                    </el-form-item>
                    <el-form-item label="地域信息:" prop="address">
                        <el-input v-model="clueSearchForm.address" placeholder="地域信息" class="input-with-select"></el-input>
                    </el-form-item>
                    <el-form-item label="资源ID:">
                        <el-input v-model="clueSearchForm.clueId" placeholder="资源ID"  @keyup.native="number"></el-input>
                    </el-form-item>
                    <el-form-item label="QQ:">
                        <el-input v-model="clueSearchForm.qq" placeholder="QQ" maxLength="20" @keyup.native="number"></el-input>
                    </el-form-item>
                    <el-form-item label="微信:">
                        <el-input v-model="clueSearchForm.wechat" placeholder="微信"></el-input>
                    </el-form-item>
                    <el-form-item label="邮箱:">
                        <el-input v-model="clueSearchForm.email" placeholder="邮箱"></el-input>
                    </el-form-item>
                    <el-form-item label="资源来源:">
	                    <el-select v-model="clueSearchForm.teleDirectorReceiveSource" clearable placeholder="资源来源">
	                        <el-option v-for="item in teleReceiveSourceArr" :key="item.value" :label="item.name"
	                                   :value="item.value"></el-option>
	                    </el-select>
	                </el-form-item>
                </el-row>
                <div class="mainSearchBtnBox">
                    <el-button icon="el-icon-search" type="primary" @click="searchTable()" class="searchBtn">搜索</el-button>
                    <!-- <el-button type="info" class="searchBtn">取消</el-button> -->
                    <span style="color: #5c6be8;cursor: pointer;margin:0 10px;" @click="toogleClick"><span v-if="isShow">收起</span><span v-else>展开更多</span><i :class="{'greycolor paddingL6 el-icon-arrow-up':isShow,'greycolor paddingL6 el-icon-arrow-down':!isShow}"></i></span>
                </div>
            </el-form>
        </div>
        <el-row>
            <el-table  ref="multipleTable" tooltip-effect="dark" border @selection-change="handleSelectionChange" @row-click="clickRow" @row-dblclick="showClueDetailInfo" style="width: 100%"  :data="dataTable" key="multipleTable">
                <el-table-column align="center" type="selection" label="全选" width="50"></el-table-column>
                <el-table-column align="center" type="index" label="序号" width="55"></el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"
                                 v-for="(item,key,index) in tableColums" v-if="item.fieldCode == 'releaseNum'">
                    <template slot-scope="scope">
                        <div v-if="scope.row.releaseNum > 0">
                            <el-button @click="showRelease(scope.row)" type="text" size="small">{{scope.row.releaseNum}}</el-button>
                        </div>
                        <div v-else>无</div>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"
                                 v-else-if="item.fieldCode == 'isRepeatPhone'">
                    <template slot-scope="scope">
                        <div v-if="scope.row.isRepeatPhone ==1">
                            <el-button @click="showRepeatPhone(scope.row)" type="text" size="small">点击查看</el-button>
                        </div>
                        <div v-else></div>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-else-if="item.fieldCode == 'phone'">
                    <!--  <template slot-scope="scope">{{scope.row.phone}}<input type='hidden'><img th:src="@{/images/tel.png}" @click="customerEidt(scope.row.clueId)" style="margin:0 10px;width:22px;cursor: pointer;vertical-align: middle;" alt=""><el-tag v-if="scope.row.tag">{{scope.row.tag}}</el-tag></template> -->
                    <template slot-scope="scope">
                        {{scope.row.phone}}<span v-if="scope.row.phoneLocale != null && scope.row.phoneLocale != ''">（{{scope.row.phoneLocale}}）</span>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-else-if="item.fieldCode == 'phone2'">
                    <template slot-scope="scope">
                        {{scope.row.phone2}}<span v-if="scope.row.phone2Locale != null && scope.row.phone2Locale != ''">（{{scope.row.phone2Locale}}）</span>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-else-if="item.fieldCode == 'phone3'">
                    <template slot-scope="scope">
                        {{scope.row.phone3}}<span v-if="scope.row.phone3Locale != null && scope.row.phone3Locale != ''"> （{{scope.row.phone3Locale}}）</span>
                    </template>
                </el-table-column>

                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"
                                 v-else-if="item.fieldCode == 'cusName'">
                    <template slot-scope="scope">
                        {{scope.row.cusName}}
                        <span v-if="scope.row.inputType ==1">
                            <input type='hidden'><img th:src="@{/images/self_build.png}"  style="margin:0 10px;width:22px;cursor: pointer;vertical-align: middle;" alt="">
                        </span>
                        <span v-else-if="scope.row.phtraCustomerStatus ==4">
                            <input type='hidden'><img th:src="@{/images/fromTraffic.png}"  style="margin:0 10px;width:44px;cursor: pointer;vertical-align: middle;" alt="">
                        </span>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"
                                 v-else-if="item.fieldCode == 'hasRepeatClue'">
                    <template slot-scope="scope">
                        <span v-if="scope.row.hasRepeatClue ==1">
                           <el-button @click="showHasRepeatClue(scope.row)" type="text" size="small">点击查看</el-button>
                        </span>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"
                                 v-else-if="item.fieldCode == 'projectName'">
                    <template slot-scope="scope">
                        <span v-if="telemarketingLayoutProjectIsShow(scope.row.categoryNum)">
                           {{scope.row.projectName}}
                        </span>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"
                                 v-else-if="item.fieldCode == 'sourceName'">
                    <template slot-scope="scope">
                        <span v-if="telemarketingLayoutSourceIsShow(scope.row.categoryNum)">
                           {{scope.row.sourceName}}
                        </span>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"
                                 v-else>
                </el-table-column>

            </el-table>
            <table-pagination v-if="paginationShow" :pager="pager" @change="searchTable"></table-pagination>
        </el-row>
    </div>
    <!-- dialog -->
    <el-dialog  title="分配资源"  :visible.sync="allocationVisible"  width="540px">
        <template>
            <el-form :model="allocationForm" ref="allocationForm" :rules="allocationFormRules">
                <el-form-item label="电销顾问：" :label-width="formLabelWidth"  prop="saleId">
                    <el-select v-model="allocationForm.saleId" placeholder="组内电销顾问" style="width: 290px;">
                        <el-option v-for="item in saleOptions"
                                   :key="item.id"
                                   :label="item.name"
                                   :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <!-- <el-form-item label="客户级别：" :label-width="formLabelWidth"  prop="cusLevel">
                    <el-select v-model="allocationForm.cusLevel"  style="width: 290px;">
                    	<el-option key="-1" label="不处理" value="-1"> </el-option>
                        <el-option v-for="item in levelOptions"
                			:key="item.value"
                			:label="item.name"
                			:value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item> -->
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" :disabled="isDisabled" @click="allocationClue('allocationForm')">提 交</el-button>
                <el-button  @click="allocationVisible = false">取 消</el-button>
            </div>
        </template>
    </el-dialog>
    <!-- dialog -->
    <!-- dialog -->
    <el-dialog  title="转移资源"  :visible.sync="transferVisible"  width="540px">
        <template>
            <el-form :model="transferForm" ref="transferForm" :rules="transferFormRules">
                <el-form-item label="电销总监："  :label-width="formLabelWidth"  prop="id">
                    <el-select v-model="transferForm.id" placeholder="同事业部的组名（总监姓名）" filterable style="width: 290px;">
                        <el-option v-for="item in saleGroupOptions"
                                   :key="item.id"
                                   :label="item.name"
                                   :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" :disabled="isDisabled" @click="transferClue('transferForm')">提 交</el-button>
                <el-button  @click="transferVisible = false">取 消</el-button>
            </div>
        </template>
    </el-dialog>
    <!-- dialog -->
    <!-- dialog -->
    <el-dialog  title="信息流批量分发"  :visible.sync="batchVisible"  width="540px">
        <template>
            <el-form :model="batchForm" ref="batchForm" :rules="batchFormRules">
                <el-form-item label="信息流分配规则" :label-width="formLabelWidth"  prop="ruleId">
                    <el-select v-model="batchForm.ruleId">
                        <el-option v-for="item in ruleOptions"
                                   :key="item.id"
                                   :label="item.assignName"
                                   :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="batchClue('batchForm')">提 交</el-button>
                <el-button  @click="batchVisible = false">取 消</el-button>
            </div>
        </template>
    </el-dialog>
    <!-- dialog -->
    <!-- dialog -->
    <el-dialog  title="副总分发"  :visible.sync="ceoVisible"  width="540px">
        <template>
            <el-form :model="ceoForm" ref="ceoForm" :rules="ceoFormRules">
                <el-form-item label="电销总监：" :label-width="formLabelWidth"  prop="id">
                    <el-select v-model="ceoForm.id" placeholder="同事业部的组名（总监姓名）" @change="getSaleList" style="width: 290px;">
                        <el-option v-for="item in orgOptions"
                                   :key="item.id"
                                   :label="item.name"
                                   :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="电销顾问：" :label-width="formLabelWidth"  prop="teleSaleId">
                    <el-select v-model="ceoForm.teleSaleId" style="width: 290px;">
                        <el-option v-for="item in teleSaleOptions"
                                   :key="item.id"
                                   :label="item.name"
                                   :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" :disabled="isDisabled" @click="ceoClue('ceoForm')">提 交</el-button>
                <el-button  @click="ceoVisible = false">取 消</el-button>
            </div>
        </template>
    </el-dialog>
    <!-- 资源释放记录 -->
    <el-dialog title="资源释放记录" :visible.sync="releaseDialog">
        <el-table
                ref="singleTable"
                tooltip-effect="dark"
                style="width: 100%"
                border
                :data="releaseTable"
        >
            <el-table-column align="center" type="index" width="55" label="序号"></el-table-column>
            <el-table-column align="center" prop="releaseTime" label="释放时间"></el-table-column>
            <el-table-column align="center" prop="releaseReason" label="释放原因" :formatter="transformReason"></el-table-column>
            <el-table-column align="center" prop="teleSaleName" label="释放人顾问姓名"></el-table-column>
            <el-table-column align="center" prop="teleGroupName" label="所属电销组"></el-table-column>
        </el-table>

    </el-dialog>
    <!-- dialog -->
    <el-dialog title="自定义列" :visible.sync="dialogFormVisible" class="elCheckboxGroup">
        <el-form :model="form">
            <el-form-item label="" prop="type">
                <el-checkbox-group v-model="form.type">
                    <el-checkbox :label="item.sortNum+'_'+item.fieldCode+'_'+item.displayName+'_'+item.id+'_'+item.width"  name="type" :key="item.fieldCode"  v-for="(item,index) in  allTableColums ">
                        {{item.displayName}}
                    </el-checkbox>
                </el-checkbox-group>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="confirmColumn">确 定</el-button>
            <el-button @click="dialogFormVisible = false">取 消</el-button>
        </div>
    </el-dialog>
    <el-dialog :title="'资源ID'+dailogTitleType+'重复手机号资源信息'"    :visible.sync="repeatPhonesDialog" width="1000px">
        <div v-show="showPhoneTable">
            <p style="margin:10px 0;">手机号<span style="color: red">(1)</span>{{phone}}重复手机号资源</p>
            <el-table ref="singleTable" tooltip-effect="dark" style="width: 100%" border :data="repeatPhonesTable">
                <el-table-column align="center" type="index" width="55" label="序号"></el-table-column>
                <el-table-column align="center" prop="createTime" label="资源创建时间" width="150">
                    <template slot-scope="scope">
                        <div v-if="scope.row.phase == 1 || scope.row.phase == 2">
                            <font color="red">「重话务」</font>{{scope.row.createTime}}
                        </div>
                        <div v-else>
                            {{scope.row.createTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="phoneChangeTime" label="联系方式创建时间" width="150"></el-table-column>
                <el-table-column align="center" prop="teleDirectorName" label="电销总监" width="130"></el-table-column>
                <el-table-column align="center" prop="teleSaleName" label="电销顾问" width="130"></el-table-column>
                <el-table-column align="center" prop="teleGorupName" label="电销组" width="130"></el-table-column>
                <el-table-column align="center" prop="teleReceiveTime" label="分配时间" width="170">
                    <template slot-scope="scope">
                        <div v-if="scope.row.teleReceiveSource == 1 || scope.row.teleReceiveSource == 2">
                            {{scope.row.teleReceiveTime}}(分配)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===3">
                            {{scope.row.teleReceiveTime}}(领取)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===4">
                            {{scope.row.teleReceiveTime}}(自建)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===5">
                            {{scope.row.teleReceiveTime}}(分发)
                        </div>
                        <div v-else>
                            {{scope.row.teleReceiveTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="fowEndTime" label="最新跟进时间"></el-table-column>
                <el-table-column align="center" prop="teleProject" label="电销组负责项目"></el-table-column>
                <el-table-column align="center" prop="createUserRoleName" label="资源创建人角色" width="130"></el-table-column>
                <el-table-column align="center" prop="createUserName" label="资源创建人" width="110"></el-table-column>
            </el-table>
        </div>
        <div v-show="showPhoneTable2">
            <p style="margin:10px 0;">手机号<span style="color: red">(2)</span>{{phone2}}重复手机号资源</p>
            <el-table ref="singleTable2" tooltip-effect="dark" style="width: 100%" border :data="repeatPhonesTable2">
                <el-table-column align="center" type="index" width="55" label="序号"></el-table-column>
                <el-table-column align="center" prop="createTime" label="资源创建时间" width="150">
                    <template slot-scope="scope">
                        <div v-if="scope.row.phase == 1 || scope.row.phase == 2">
                            <font color="red">「重话务」</font>{{scope.row.createTime}}
                        </div>
                        <div v-else>
                            {{scope.row.createTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="phoneChangeTime" label="联系方式创建时间" width="150"></el-table-column>
                <el-table-column align="center" prop="teleDirectorName" label="电销总监" width="130"></el-table-column>
                <el-table-column align="center" prop="teleSaleName" label="电销顾问" width="130"></el-table-column>                
                <el-table-column align="center" prop="teleGorupName" label="电销组" width="130"></el-table-column>
                <el-table-column align="center" prop="teleReceiveTime" label="分配时间" width="170">
                    <template slot-scope="scope">
                        <div v-if="scope.row.teleReceiveSource == 1 || scope.row.teleReceiveSource == 2">
                            {{scope.row.teleReceiveTime}}(分配)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===3">
                            {{scope.row.teleReceiveTime}}(领取)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===4">
                            {{scope.row.teleReceiveTime}}(自建)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===5">
                            {{scope.row.teleReceiveTime}}(分发)
                        </div>
                        <div v-else>
                            {{scope.row.teleReceiveTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="fowEndTime" label="最新跟进时间"></el-table-column>
                <el-table-column align="center" prop="teleProject" label="电销组负责项目"></el-table-column>
                <el-table-column align="center" prop="createUserRoleName" label="资源创建人角色" width="130"></el-table-column>
                <el-table-column align="center" prop="createUserName" label="资源创建人" width="110"></el-table-column>
            </el-table>
        </div>
        <div v-show="showPhoneTable3">
            <p style="margin:10px 0;">手机号<span style="color: red">(3)</span>{{phone3}}重复手机号资源</p>
            <el-table ref="singleTable3" tooltip-effect="dark" style="width: 100%" border :data="repeatPhonesTable3">
                <el-table-column align="center" type="index" width="55" label="序号"></el-table-column>
                <el-table-column align="center" prop="createTime" label="资源创建时间" width="150">
                    <template slot-scope="scope">
                        <div v-if="scope.row.phase == 1 || scope.row.phase == 2">
                            <font color="red">「重话务」</font>{{scope.row.createTime}}
                        </div>
                        <div v-else>
                            {{scope.row.createTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="phoneChangeTime" label="联系方式创建时间" width="150"></el-table-column>
                <el-table-column align="center" prop="teleDirectorName" label="电销总监" width="130"></el-table-column>
                <el-table-column align="center" prop="teleSaleName" label="电销顾问" width="130"></el-table-column>
                <el-table-column align="center" prop="teleGorupName" label="电销组" width="130"></el-table-column>
                <el-table-column align="center" prop="teleReceiveTime" label="分配时间" width="170">
                    <template slot-scope="scope">
                      <div v-if="scope.row.teleReceiveSource == 1 || scope.row.teleReceiveSource == 2">
                        {{scope.row.teleReceiveTime}}(分配)
                      </div>
                      <div v-else-if="scope.row.teleReceiveSource ===3">
                        {{scope.row.teleReceiveTime}}(领取)
                      </div>
                      <div v-else-if="scope.row.teleReceiveSource ===4">
                        {{scope.row.teleReceiveTime}}(自建)
                      </div>
                      <div v-else-if="scope.row.teleReceiveSource ===5">
                        {{scope.row.teleReceiveTime}}(分发)
                      </div>
                      <div v-else>
                        {{scope.row.teleReceiveTime}}
                      </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="fowEndTime" label="最新跟进时间"></el-table-column>
                <el-table-column align="center" prop="teleProject" label="电销组负责项目"></el-table-column>
                <el-table-column align="center" prop="createUserRoleName" label="资源创建人角色" width="130"></el-table-column>
                <el-table-column align="center" prop="createUserName" label="资源创建人" width="110"></el-table-column>
            </el-table>
        </div>
        <div v-show="showPhoneTable4">
            <p style="margin:10px 0;">手机号<span style="color: red">(4)</span>{{phone4}}重复手机号资源</p>
            <el-table ref="singleTable4" tooltip-effect="dark" style="width: 100%" border :data="repeatPhonesTable4">
                <el-table-column align="center" type="index" width="55" label="序号"></el-table-column>
                <el-table-column align="center" prop="createTime" label="资源创建时间" width="150">
                    <template slot-scope="scope">
                        <div v-if="scope.row.phase == 1 || scope.row.phase == 2">
                            <font color="red">「重话务」</font>{{scope.row.createTime}}
                        </div>
                        <div v-else>
                            {{scope.row.createTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="phoneChangeTime" label="联系方式创建时间" width="150"></el-table-column>
                <el-table-column align="center" prop="teleDirectorName" label="电销总监" width="130"></el-table-column>
                <el-table-column align="center" prop="teleSaleName" label="电销顾问" width="130"></el-table-column>
                <el-table-column align="center" prop="teleGorupName" label="电销组" width="130"></el-table-column>
                <el-table-column align="center" prop="teleReceiveTime" label="分配时间" width="170">
                    <template slot-scope="scope">
                      <div v-if="scope.row.teleReceiveSource == 1 || scope.row.teleReceiveSource == 2">
                        {{scope.row.teleReceiveTime}}(分配)
                      </div>
                      <div v-else-if="scope.row.teleReceiveSource ===3">
                        {{scope.row.teleReceiveTime}}(领取)
                      </div>
                      <div v-else-if="scope.row.teleReceiveSource ===4">
                        {{scope.row.teleReceiveTime}}(自建)
                      </div>
                      <div v-else-if="scope.row.teleReceiveSource ===5">
                        {{scope.row.teleReceiveTime}}(分发)
                      </div>
                      <div v-else>
                        {{scope.row.teleReceiveTime}}
                      </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="fowEndTime" label="最新跟进时间"></el-table-column>
                <el-table-column align="center" prop="teleProject" label="电销组负责项目"></el-table-column>
                <el-table-column align="center" prop="createUserRoleName" label="资源创建人角色" width="130"></el-table-column>
                <el-table-column align="center" prop="createUserName" label="资源创建人" width="110"></el-table-column>
            </el-table>
        </div>
        <div v-show="showPhoneTable5">
            <p style="margin:10px 0;">手机号<span style="color: red">(5)</span>{{phone5}}重复手机号资源</p>
            <el-table ref="singleTable5" tooltip-effect="dark" style="width: 100%" border :data="repeatPhonesTable5">
                <el-table-column align="center" type="index" width="55" label="序号"></el-table-column>
                <el-table-column align="center" prop="createTime" label="资源创建时间" width="150">
                    <template slot-scope="scope">
                        <div v-if="scope.row.phase == 1 || scope.row.phase == 2">
                            <font color="red">「重话务」</font>{{scope.row.createTime}}
                        </div>
                        <div v-else>
                            {{scope.row.createTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="phoneChangeTime" label="联系方式创建时间" width="150"></el-table-column>
                <el-table-column align="center" prop="teleDirectorName" label="电销总监" width="130"></el-table-column>
                <el-table-column align="center" prop="teleSaleName" label="电销顾问" width="130"></el-table-column>
                <el-table-column align="center" prop="teleGorupName" label="电销组" width="130"></el-table-column>
                <el-table-column align="center" prop="teleReceiveTime" label="分配时间" width="170">
                    <template slot-scope="scope">
                      <div v-if="scope.row.teleReceiveSource == 1 || scope.row.teleReceiveSource == 2">
                        {{scope.row.teleReceiveTime}}(分配)
                      </div>
                      <div v-else-if="scope.row.teleReceiveSource ===3">
                        {{scope.row.teleReceiveTime}}(领取)
                      </div>
                      <div v-else-if="scope.row.teleReceiveSource ===4">
                        {{scope.row.teleReceiveTime}}(自建)
                      </div>
                      <div v-else-if="scope.row.teleReceiveSource ===5">
                        {{scope.row.teleReceiveTime}}(分发)
                      </div>
                      <div v-else>
                        {{scope.row.teleReceiveTime}}
                      </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="fowEndTime" label="最新跟进时间"></el-table-column>
                <el-table-column align="center" prop="teleProject" label="电销组负责项目"></el-table-column>
                <el-table-column align="center" prop="createUserRoleName" label="资源创建人角色" width="130"></el-table-column>
                <el-table-column align="center" prop="createUserName" label="资源创建人" width="110"></el-table-column>
            </el-table>
        </div>
    </el-dialog>

    <el-dialog title="重复资源信息" :visible.sync="dialogFormVisible1" width="870px">
        <el-form :model="dialogForm" ref="dialogForm" class="marginB10 dialogForm" v-for="item in repeatClueList" height="600">
            <div class="fs16 redcolor marginB20">重复时间：{{formatTimeFn(item.discoverTime)}}</div>
            <div class="borderbox padding10">
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="客户姓名：" :label-width="formLabelWidth">{{item.clueDTO.clueCustomer.cusName}}</el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="手机号：" :label-width="formLabelWidth" >{{getPhones(item.clueDTO.clueCustomer)}}</el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="微信：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueCustomer.wechat}}<span @click="lookWechat(item.clueDTO.clueCustomer)" v-if="(item.clueDTO.clueCustomer.wechat2 !=null && item.clueDTO.clueCustomer.wechat2 !='')||(item.clueDTO.clueCustomer.wechatCode !=null && item.clueDTO.clueCustomer.wechatCode !='')" style="color: rgb(0, 114, 255); cursor: pointer;">查看更多</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="邮箱：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueCustomer.email}}
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="QQ：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueCustomer.qq}}
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="资源类型：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueBasic.typeName}}
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="留言时间：" :label-width="formLabelWidth">
                            {{formatTimeFn(item.clueDTO.clueBasic.messageTime)}}
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="资源类别：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueBasic.categoryName}}
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="搜索词：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueBasic.searchWord}}
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="留言重点：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueBasic.messagePoint}}
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="地域信息：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueIntention.address}}
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="备注：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueBasic.remark}}
                        </el-form-item>
                    </el-col>
                </el-row>
                <div v-if="telemarketingLayout !=null && (','+telemarketingLayout.category+',').indexOf(','+item.clueDTO.clueBasic.category+',') != -1">
                    <el-row >
                        <el-col :span="12" v-if="telemarketingLayout.projectShow ==1">
                            <el-form-item label="资源项目：" :label-width="formLabelWidth">
                                {{item.clueDTO.clueProject.projectName}}
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" v-if="telemarketingLayout !=null && telemarketingLayout.sourceShow ==1">
                            <el-form-item label="媒介：" :label-width="formLabelWidth">
                                {{item.clueDTO.clueBasic.sourceName}}
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12" v-if="telemarketingLayout !=null && telemarketingLayout.adShow ==1">
                            <el-form-item label="广告文案：" :label-width="formLabelWidth">
                                {{item.clueDTO.clueBasic.ad}}
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12" v-if="telemarketingLayout !=null && telemarketingLayout.urlShow ==1">
                            <el-form-item label="URL：" :label-width="formLabelWidth">
                                {{item.clueDTO.clueReceive.urlAddress}}
                            </el-form-item>
                        </el-col>
                    </el-row>
                </div>
            </div>
        </el-form>
    </el-dialog>
    <el-dialog title="查看微信/二维码" :visible.sync="repeatWechatVisible">
        <el-form :model="repeatWeDialogForm" ref="repeatWeDialogForm">
            <!--展示phone2  phone3  phone4 phone5-->
            <el-form-item  label="微信2：" :label-width="formLabelWidth"  >
                <el-button type="text" disabled>{{repeatCustomer.wechat2}}</el-button>
            </el-form-item>
            <el-form-item  label="图片二维码：" :label-width="formLabelWidth"  >
                <img v-show="repeatCustomer.wechatCode!=''"  :src="repeatCustomer.wechatCode">
            </el-form-item>
        </el-form>
    </el-dialog>

</div>
<!-- import common js-->
<div th:include="_footer_include :: #jsLib"></div>
</body>
<script th:inline="javascript">
    var telemarketingLayout = [[${telemarketingLayout}]];
    var teleGorupList=[[${teleGorupList}]];//电销组查询筛选条件
    var orgList=[[${orgList}]];//电销组
    var saleList=[[${saleList}]];//电销顾问
    var saleGroupList=[[${saleGroupList}]];//同事业部下电销组
    var ruleList=[[${ruleList}]];//规则
    var clueCategoryList=[[${clueCategoryList}]];//资源类别
    var clueTypeList=[[${clueTypeList}]];//资源类型
    var fieldList=[[${fieldList}]];//自定义字段
    var userFieldList=[[${userFieldList}]];//用户自定义字段
    var releaseReasonList=[[${releaseReasonList}]];//释放原因
    var customerStatusList=[[${customerStatusList}]];//电销一级客户状态
    var customerStatusSubList=[[${customerStatusSubList}]];//电销二级客户状态
    var phCustomerStatusList=[[${phCustomerStatusList}]];//话务一级客户状态
    var phCustomerStatusSubList=[[${phCustomerStatusSubList}]];//话务二级客户状态
    var levelList=[[${levelList}]];//客户级别
    var ownOrgId=[[${ownOrgId}]];//电销总监电销组
    // 业务线(待分配新资源页面和客户管理页面允许外包业务线复制，外包业务线编码如下：1、5、6、10、11、12、13)
    var businessLine=[[${businessLine}]];
    var canCopy=[[${canCopy}]];
    var roleCode = [[${roleCode}]];
    var clueVM = new Vue({
        el: '#clueManage',
        data: {
            roleCode:roleCode,
            telemarketingLayout:telemarketingLayout,
            dialogForm: {
                phoneNum: ''
            },
            repeatWeDialogForm:{},
            repeatWechatVisible:false,
            repeatCustomer:{},
            repeatClueList:[],
            dialogFormVisible1:false,
            paginationShow: false,
            isDisabled:false,//默认不可点击
            isShow:false,
            isDXZDisabled:false,
            clueSearchForm: {
                phone: '',
                cusName: '',
                category: '',
                teleGorupId:ownOrgId,
                type: '',
                startTime: '',
                endTime: '',
                messagePoint: '',
                searchWord: '',
                address: '',
                clueId:'',
                qq:'',
                email:'',
                wechat:'',
                teleReceiveSource:''
            },
            allocationForm: {
                saleId:'',
                //cusLevel:''
            },
            transferForm: {
                id:''
            },
            batchForm: {
                ruleId:''
            },
            ceoForm: {
                id:'',
                teleSaleId:''
            },
            allocationFormRules: {
                saleId: [
                    { required: true, message: '请选择电销顾问', trigger: 'blur' }
                ]
            },
            transferFormRules: {
                id: [
                    { required: true, message: '请选择电销总监', trigger: 'blur' }
                ]
            },
            batchFormRules: {
                ruleId: [
                    { required: true, message: '请选择分配规则', trigger: 'blur' }
                ]
            },
            ceoFormRules: {
                id: [
                    { required: true, message: '请选择电销总监', trigger: 'blur' }
                ],
                teleSaleId: [
                    { required: true, message: '请选择电销顾问', trigger: 'blur' }
                ]
            },
            dataTable:[],
            loading: true,
            allTableColums:[],
            tableColums:[],
            repeatPhonesTable:[],
            repeatPhonesTable2:[],
            repeatPhonesTable3:[],
            repeatPhonesTable4:[],
            repeatPhonesTable5:[],
            teleReceiveSourceArr:[
              	 {value:"1",name:"领取"},
                 {value:"2",name:"分配"},
              ],
            showPhoneTable:false,
            showPhoneTable2:false,
            showPhoneTable3:false,
            showPhoneTable4:false,
            showPhoneTable5:false,
            phone:'',
            phone2:'',
            phone3:'',
            phone4:'',
            phone5:'',
            dialogFormVisible: false,
            repeatPhonesDialog:false,
            form: {
                type: [],
            },
            dailogTitleType:"",
            orgOptions:orgList,
            saleOptions:saleList,
            ruleOptions:ruleList,
            teleGorupOptions:teleGorupList,
            saleGroupOptions:saleGroupList,
            categoryOptions:clueCategoryList,
            levelOptions:levelList,
            typeOptions:clueTypeList,
            teleSaleOptions:[],
            releaseTable:[],
            allocationVisible: false,
            transferVisible: false,
            batchVisible: false,
            ceoVisible: false,
            releaseDialog:false,
            pager:{
                total: 0,
                currentPage: 1,
                pageSize: 20,
            },
            multipleSelection:[],
            formLabelWidth: '150px',
            formLabelWidth1: '120px',
            storeForm: {
                phone: '',
                cusName: '',
                category: '',
                teleGorupId: ownOrgId,
                type: '',
                startTime: '',
                endTime: '',
                messagePoint: '',
                searchWord: '',
                address: '',
                clueId:'',
                qq:'',
                email:'',
                wechat:''
            },
            storeId: '',
            scrollTop: 0,

        },
        methods: {
            //展现详情
            // showClueDetailInfo (row, column) {
            //     window.location.href='/tele/clueMyCustomerInfo/customerInfoReadOnly?clueId='+row.id;
            // },
            showClueDetailInfo (row, column) {
                // 存储选中信息--start
                var clueId=row.id;
                setSessionStore("pendingAllocationManagerStoreForm", this.storeForm);
                var otherVal = {
                    "currentPage": this.pager.currentPage,
                    "clueId": clueId,
                    "scrollTop": this.$el.querySelector('.el-table__body-wrapper').scrollTop
                }
                setSessionStore("pendingAllocationManagerOtherVal", otherVal);
                // 存储选中信息--end
                window.location.href='/tele/clueMyCustomerInfo/customerInfoReadOnly?clueId='+clueId;
            },
            clickRow(row){
                this.$refs.multipleTable.toggleRowSelection(row)
            },
            searchTable() {
                var param ={};

                var startTime = this.clueSearchForm.startTime;
                var endTime = this.clueSearchForm.endTime;
                if(startTime&&endTime&&startTime> endTime){
                    this.$message({
                        message: '开始时间不能大于结束时间',
                        type: 'warning'
                    });
                    return;
                }
                param.pageSize = this.pager.pageSize;
                param.pageNum = this.pager.currentPage;
                param.startTime = this.clueSearchForm.startTime;
                param.endTime = this.clueSearchForm.endTime;
                param.teleGorupId = this.clueSearchForm.teleGorupId;
                param.messagePoint = this.clueSearchForm.messagePoint;
                param.searchWord = this.clueSearchForm.searchWord;
                param.address = this.clueSearchForm.address;
                param.phone = this.clueSearchForm.phone;
                param.cusName = this.clueSearchForm.cusName;
                param.category = this.clueSearchForm.category;
                param.type = this.clueSearchForm.type;
                param.clueId = this.clueSearchForm.clueId;
                param.qq = this.clueSearchForm.qq;
                param.email = this.clueSearchForm.email;
                param.wechat = this.clueSearchForm.wechat;
                param.teleDirectorReceiveSource = this.clueSearchForm.teleDirectorReceiveSource;
                console.info(param);
                axios.post('/clue/pendingAllocation/list', param)
                    .then(function (response) {
                        var result =  response.data;
                        console.info(result);
                        var table=result.data;
                        var data= table.data;
                        for(var i=0;i<data.length;i++){
                            data[i].categoryNum=data[i].category;
                            data[i].category=clueVM.transformCategory(data[i].category);
                            data[i].type=clueVM.transformType(data[i].type);
                            data[i].createTime=clueVM.dateFormat(data[i].createTime);
                            data[i].messageTime=clueVM.dateFormat(data[i].messageTime);
                        }
                        clueVM.dataTable= data;
                        clueVM.pager.total =  table.total;
                        clueVM.pager.currentPage = table.currentPage;

                        // 取出存储的id
                        if(!clueVM.paginationShow){
                            if(clueVM.storeId){
                                clueVM.$nextTick(function(){
                                    var storage = [];
                                    clueVM.dataTable.forEach(function(item, index){
                                        if(item.id === clueVM.storeId ){
                                            storage.push(clueVM.dataTable[index]);
                                        }
                                    })
                                    clueVM.toggleSelection(storage);
                                    clueVM.$el.querySelector('.el-table__body-wrapper').scrollTop = clueVM.scrollTop;
                                })
                            }
                        }else{
                            removeSessionStore ("pendingAllocationManagerStoreForm");
                            removeSessionStore ("pendingAllocationManagerOtherVal");
                        }
                        clueVM.paginationShow = true;
                        clueVM.storeForm = clueVM.clueSearchForm;

                    })
                    .catch(function (error) {
                        console.log(error);
                    });

            },
            toggleSelection(rows) { // table select 默认选中fn
                if (rows) {
                    rows.forEach(row => {
                        this.$refs.multipleTable.toggleRowSelection(row,true);
                    });
                } else {
                    this.$refs.multipleTable.clearSelection();
                }
            },
            //选择行
            handleSelectionChange(val) {
                this.multipleSelection = val;
            },
            handleSizeChange(val) {
                //下拉框  每页 10,20条切换 调用
                console.log(`每页 ${val} 条`);
                this.pageSize = val;
                this.initTableData(1);
            },
            handleCurrentChange(val) {
                //点击 页码
                console.log(`当前页: ${val}`);
                this.initTableData(val);
            },
            //类别转换方法
            transformCategory(cellValue) {
                var text="";
                if(clueCategoryList){
                    for(var i=0;i<clueCategoryList.length;i++){
                        if(cellValue==clueCategoryList[i].value){
                            text=clueCategoryList[i].name;
                        }
                    }
                }
                return text;
            },
            //类行转换方法
            transformType(cellValue) {
                var text="";
                if(clueTypeList){
                    for(var i=0;i<clueTypeList.length;i++){
                        if(cellValue==clueTypeList[i].value){
                            text=clueTypeList[i].name;
                        }
                    }
                }
                return text;
            },
            transRepeatPhone(row, column, cellValue, index) {
                var text="";
                if(cellValue=="0"){
                    text=""
                }else if(cellValue=="1"){
                    text="点击查看"
                }
                return text;
            },
            //日期数据格式化方法
            dateFormat( cellValue) {
                if (cellValue == undefined) {
                    return "";
                }
                return moment(cellValue).format("YYYY-MM-DD HH:mm");
            },
            transformReason(row, column, cellValue, index) {
                var text="";
                if(releaseReasonList){
                    for(var i=0;i<releaseReasonList.length;i++){
                        if(cellValue==releaseReasonList[i].value){
                            text=releaseReasonList[i].name;
                        }
                    }
                }
                return text;
            },
            //释放原因转换方法
            //   transformReason(row, column, cellValue, index) {
            // 	  var text="";
            // 	  if(cellValue){
            //    	  var arr= cellValue.split(",");
            //    	  //用释放原因转换
            //    	  if(arr.length==1){
            //         	  if(releaseReasonList){
            //                  for(var i=0;i<releaseReasonList.length;i++){
            //                		if(cellValue==releaseReasonList[i].value){
            //                			text=releaseReasonList[i].name;
            //                		}
            //                	}
            //         	  }
            //    	  }else if(arr.length>1){
            //    		//用电销状态转换
            //    		  if(arr[0]=="track"){
            //    			//电销一级状态
            //    			  if(customerStatusList){
            // 	                  for(var i=0;i<customerStatusList.length;i++){
            // 	                	if(arr[1]==customerStatusList[i].value){
            // 	                		text+=customerStatusList[i].name;
            // 	                	}
            // 	                  }
            //             	  }
            //    			//电销二级状态
            //    			  if(customerStatusSubList&&arr.length==3){
            //    				  for(var i=0;i<customerStatusSubList.length;i++){
            //  	                if(arr[2]==customerStatusSubList[i].value){
            //  	                	text+="-"+customerStatusSubList[i].name;
            //  	                }
            //  	              }
            //    			  }
            //    			//用话务状态转换
            //    		  }else if(arr[0]=="phtrack"){
            //    			//话务一级状态
            //    			  if(phCustomerStatusList){
            // 	                  for(var i=0;i<phCustomerStatusList.length;i++){
            // 	                	if(arr[1]==phCustomerStatusList[i].value){
            // 	                		text+=phCustomerStatusList[i].name;
            // 	                	}
            // 	                  }
            //             	  }
            //    			//话务二级状态
            //    			  if(phCustomerStatusSubList&&arr.length==3){
            //    				  for(var i=0;i<phCustomerStatusSubList.length;i++){
            //  	                if(arr[2]==phCustomerStatusSubList[i].value){
            //  	                	text+="-"+phCustomerStatusSubList[i].name;
            //  	                }
            //  	              }
            //    			  }
            //    		  }
            //    	  }
            // 	  }
            //      return text;
            //   },
            //打开分配资源
            toAllocationClue() {
                var rows = this.multipleSelection;
                if(rows.length==0){
                    this.$message({
                        message: '请选择数据进行分配',
                        type: 'warning'
                    });
                    return;
                }
                this.allocationForm.saleId = '';
                this.allocationVisible = true;
            },
            allocationClue(formName){//分配资源
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        this.isDisabled = true;
                        var rows = this.multipleSelection;
                        var rowIds = [];
                        for(var i=0;i<rows.length;i++){
                            var curRow = rows[i];
                            rowIds.push(curRow.id);
                        }
                        //分配
                        var param  = {};
                        param.idList=rowIds;
                        param.teleSaleId=this.allocationForm.saleId;
                        param.operatorType = 1;
                        axios.post('/clue/pendingAllocation/allocationClue',param)
                            .then(function (response) {
                                var data =  response.data;
                                if(data.code=='0'){
                                    clueVM.$message({message:'分配成功',type:'success',duration:2000,onClose:function(){
                                            clueVM.allocationVisible = false;
                                            clueVM.isDisabled = false;
                                            clueVM.searchTable();
                                        }});
                                }else if (data.code == '21917' || data.code == '21918') {
                                    clueVM.$message({
                                        message: data.msg,
                                        type: 'warning'
                                    });
                                    clueVM.isDisabled = false;
                                    clueVM.allocationVisible = false;
                                    clueVM.searchTable();
                                }else{
                                    clueVM.$message({
                                        message: "接口调用失败",
                                        type: 'error'
                                    });
                                    clueVM.isDisabled = false;
                                }
                            })
                            .catch(function (error) {
                                clueVM.isDisabled = false;
                                console.log(error);
                            })
                            .then(function () {

                            });
                    } else {
                        console.log('数据未通过校验！');
                        return false;
                    }
                });

            },// method end
            //打开转移资源
            toTransferClue() {
                var rows = this.multipleSelection;
                if(rows.length==0){
                    this.$message({
                        message: '请选择数据进行转移',
                        type: 'warning'
                    });
                    return;
                }
                this.transferForm.id = '';
                this.transferVisible = true;
            },
            transferClue(formName){//转移资源
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        this.isDisabled = true;
                        var rows = this.multipleSelection;
                        var rowIds = [];
                        for(var i=0;i<rows.length;i++){
                            var curRow = rows[i];
                            rowIds.push(curRow.id);
                        }
                        //转移
                        var param  = {};
                        param.idList=rowIds;
                        var id=this.transferForm.id;
                        var idArray=id.split(",");
                        param.teleGorupId=idArray[0];
                        param.teleDirectorId=idArray[1];
                        axios.post('/clue/pendingAllocation/transferClue',param)
                            .then(function (response) {
                                var data =  response.data;
                                if(data.code=='0'){
                                    clueVM.$message({message:'转移成功',type:'success',duration:2200,onClose:function(){
                                            clueVM.transferVisible = false;
                                            clueVM.isDisabled = false;
                                            clueVM.searchTable();
                                        }});
                                }else{
                                    clueVM.$message({
                                        message: "接口调用失败",
                                        type: 'error'
                                    });
                                    clueVM.isDisabled = false;
                                }
                            })
                            .catch(function (error) {
                                clueVM.isDisabled = false;
                                console.log(error);
                            })
                            .then(function () {

                            });
                    } else {
                        console.log('数据未通过校验！');
                        return false;
                    }
                });

            },// method end
            //打开批量分发
            toBatchClue() {
                var rows = this.multipleSelection;
                if(rows.length==0){
                    this.$message({
                        message: '请选择数据进行分发',
                        type: 'warning'
                    });
                    return;
                }
                this.batchVisible = true;
            },
            batchClue(formName){//批量分发
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        var rows = this.multipleSelection;
                        var rowIds = [];
                        for(var i=0;i<rows.length;i++){
                            var curRow = rows[i];
                            rowIds.push(curRow.id);
                        }
                        //转移
                        var param  = {};
                        param.idList=rowIds;
                        param.assignId=this.batchForm.ruleId;
                        axios.post('/clue/pendingAllocation/batchDistributionClue',param)
                            .then(function (response) {
                                var data =  response.data;
                                if(data.code=='0'){
                                    clueVM.$message({message:'批量分发成功',type:'success',duration:2000,onClose:function(){
                                            clueVM.batchVisible = false;
                                            clueVM.searchTable();
                                        }});
                                }else{
                                    clueVM.$message({
                                        message: "接口调用失败",
                                        type: 'error'
                                    });
                                }
                            })
                            .catch(function (error) {
                                console.log(error);
                            })
                            .then(function () {

                            });
                    } else {
                        console.log('数据未通过校验！');
                        return false;
                    }
                });

            },// method end
            //打开副总分发
            toCeoClue() {
                var rows = this.multipleSelection;
                if(rows.length==0){
                    this.$message({
                        message: '请选择数据进行分发',
                        type: 'warning'
                    });
                    return;
                }
                this.ceoForm.id= '';
                this.ceoForm.teleSaleId= '';
                this.ceoVisible = true;
            },
            ceoClue(formName){//副总分发
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        var rows = this.multipleSelection;
                        var rowIds = [];
                        for(var i=0;i<rows.length;i++){
                            var curRow = rows[i];
                            rowIds.push(curRow.id);
                        }
                        var param  = {};
                        param.idList=rowIds;
                        var id=this.ceoForm.id;
                        var idArray=id.split(",");
                        param.teleGorupId=idArray[0];
                        param.teleDirectorId=idArray[1];
                        param.teleSaleId=this.ceoForm.teleSaleId;
                        param.operatorType = 1;
                        this.isDisabled = true;

                        axios.post('/clue/pendingAllocation/ceoDistributionClue',param)
                            .then(function (response) {
                                var data =  response.data;
                                if(data.code=='0'){
                                    clueVM.$message({message:'副总分发成功',type:'success',duration:2000,onClose:function(){
                                            clueVM.ceoVisible = false;
                                            clueVM.isDisabled = false;
                                            clueVM.searchTable();
                                        }});
                                }else if (data.code == '21917' || data.code == '21918') {
                                    clueVM.$message({
                                        message: data.msg,
                                        type: 'warning'
                                    });
                                    clueVM.isDisabled = false;
                                    clueVM.ceoVisible = false;
                                    clueVM.searchTable();
                                }else{
                                    clueVM.$message({
                                        message: "接口调用失败",
                                        type: 'error'
                                    });
                                    clueVM.isDisabled = false;
                                }
                            })
                            .catch(function (error) {
                                console.log(error);
                                clueVM.isDisabled = false;
                            });
                    } else {
                        console.log('数据未通过校验！');
                        return false;
                    }
                });

            },// method end
            //查看资源释放记录
            showRelease(row) {
                var param ={};
                param.clueId = row.id;
                console.info(param);
                axios.post('/aggregation/releaserecord/listNoPage', param)
                    .then(function (response) {
                        var result =  response.data;
                        console.info(result);
                        var table=result.data;
                        clueVM.releaseTable= table;
                        clueVM.releaseDialog=true;
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            showRepeatPhone(row) {
                this.repeatPhonesDialog=true;
                this.dailogTitleType=row.id;
                var param ={};
                param.id = row.id;
                param.clueId = row.id;
                param.cusPhone = row.phone;
                axios.post('/clue/appiontment/repeatPhoneMap', param).then(function (response) {
                    // var result =  response.data;
                    // var table=result.data;
                    // clueVM.repeatPhonesTable=table;
                    var map = response.data.data;
                    if(map.phone){
                        clueVM.phone = map.phones[0]
                        clueVM.repeatPhonesTable=map.phone;
                        clueVM.showPhoneTable = true;
                    }else{
                        clueVM.phone = '';
                        clueVM.repeatPhonesTable=[];
                        clueVM.showPhoneTable = false;
                    }
                    if(map.phone2){
                        clueVM.phone2 = map.phones[1]
                        clueVM.repeatPhonesTable2=map.phone2;
                        clueVM.showPhoneTable2 = true;
                    }else{
                        clueVM.phone2 ='';
                        clueVM.repeatPhonesTable2=[];
                        clueVM.showPhoneTable2 = false;
                    }
                    if(map.phone3){
                        clueVM.phone3 = map.phones[2]
                        clueVM.repeatPhonesTable3=map.phone3;
                        clueVM.showPhoneTable3 = true;
                    }else{
                        clueVM.phone3 = '';
                        clueVM.repeatPhonesTable3=[];
                        clueVM.showPhoneTable3 = false;
                    }
                    if(map.phone4){
                        clueVM.phone4 = map.phones[3]
                        clueVM.repeatPhonesTable4=map.phone4;
                        clueVM.showPhoneTable4 = true;
                    }else{
                        clueVM.phone4 = ''
                        clueVM.repeatPhonesTable4=[];
                        clueVM.showPhoneTable4 = false;
                    }
                    if(map.phone5){
                        clueVM.phone5 = map.phones[4]
                        clueVM.repeatPhonesTable5=map.phone5;
                        clueVM.showPhoneTable5 = true;
                    }else{
                        clueVM.phone5 = map.phones[4]
                        clueVM.repeatPhonesTable5=[];
                        clueVM.showPhoneTable5 = false;
                    }
                    clueVM.repeatPhonesDialog=true;
                })  .catch(function (error) {
                    console.log(error);
                });
            },
            //根据电销组查询电销总监
            getSaleList() {
                clueVM.ceoForm.teleSaleId ='';
                var param ={};
                var id = this.ceoForm.id;
                var idArray=id.split(",");
                param.orgId = idArray[0];
                console.info(param);
                axios.post('/clue/pendingAllocation/getSaleList', param)
                    .then(function (response) {
                        var result =  response.data;
                        console.info(result);
                        var table=result.data;
                        clueVM.teleSaleOptions= table;
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            confirmColumn(){
                this.dialogFormVisible = false;
                //处理用户选择的列
                console.info(this.form.type);
                if(this.form.type.length==0){
                    this.$message({
                        message: "请至少保留一列",
                        type: 'error'
                    });
                    return;
                }
                var customerShowColun = [];
                var customerColumn = this.form.type;
                customerColumn.sort(this.sortNumber);//对选择的列排序
                var idList=[];
                for(var i=0;i<customerColumn.length;i++){
                    var curItem = customerColumn[i];
                    var itemArr = curItem.split("_");
                    var obj = {};
                    obj.fieldCode=itemArr[1];
                    obj.displayName=itemArr[2];
                    obj.width=itemArr[4];
                    customerShowColun.push(obj);
                    idList.push(itemArr[3])
                }
                this.tableColums = customerShowColun;
                this.dataTable=this.dataTable;
                var param ={};
                param.fieldIdList = idList;
                param.menuCode = "aggregation:pendingAllocationManager";
                console.info(param);
                if(idList.length!=0){
                    axios.post('/customfield/customField/saveUserField', param)
                        .then(function (response) {

                        })
                        .catch(function (error) {
                            console.log(error);
                        });
                }
            },
            initColumn(){
                //初始化table 列 和 用户自定义列
                this.allTableColums = fieldList;
                if(userFieldList.length!=0){
                    var type=[];
                    for(var i=0;i<userFieldList.length;i++){
                        type.push(userFieldList[i].sortNum+'_'+userFieldList[i].fieldCode+'_'+userFieldList[i].displayName+'_'+userFieldList[i].fieldId+'_'+userFieldList[i].width)
                    }
                    this.form.type = type;
                    this.confirmColumn();
                }else{
                    var type=[];
                    for(var i=0;i<fieldList.length;i++){
                        type.push(fieldList[i].sortNum+'_'+fieldList[i].fieldCode+'_'+fieldList[i].displayName+'_'+fieldList[i].id+'_'+fieldList[i].width)
                    }
                    this.form.type = type;
                    this.confirmColumn();
                }

            },
            sortNumber(a,b) {
                //对数组中元素，按照数字 从小到大 排序
                return a.split("_")[0] - b.split("_")[0];
            },
            toogleClick(){
                if(this.isShow){
                    this.isShow=false
                }else{
                    this.isShow=true
                }
            },
            showHasRepeatClue(row){
                var param ={};
                param.clueId = row.id;
                this.repeatClueList=[];
                axios.post('/tele/clueMyCustomerInfo/getRepeatClueRecordDTOList', param).then(function (response) {
                    clueVM.repeatClueList = response.data.data;
                    clueVM.dialogFormVisible1 =true;
                })

            },
            formatTimeFn(date) {
                if (null == date) {
                    return "";
                }
                var dateNew = new Date(date);
                var year = dateNew.getFullYear()
                var month = dateNew.getMonth() + 1
                var day = dateNew.getDate()
                var hour = dateNew.getHours()
                var minute = dateNew.getMinutes()
                var second = dateNew.getSeconds()
                return year + "-" + this.formatNumberFn(month) + "-" + this.formatNumberFn(day) + " " + this.formatNumberFn(hour) + ":" + this.formatNumberFn(minute) + ":" + this.formatNumberFn(second);
            },
            formatNumberFn(n) {
                n = n.toString()
                return n[1] ? n : '0' + n
            },
            getPhones(cus){
                var phones = '';
                phones = cus.phone;
                if(cus.phone2 != null && cus.phone2 != ''){
                    if(phones != ''){
                        phones = phones +","+cus.phone2;
                    }else {
                        phones = cus.phone2;
                    }
                }
                if(cus.phone3 != null && cus.phone3 != ''){
                    if(phones != ''){
                        phones = phones +","+cus.phone3;
                    }else {
                        phones = cus.phone3;
                    }
                }
                if(cus.phone4 != null && cus.phone4 != ''){
                    if(phones != ''){
                        phones = phones +","+cus.phone4;
                    }else {
                        phones = cus.phone4;
                    }
                }
                if(cus.phone4 != null && cus.phone5 != ''){
                    if(phones != ''){
                        phones = phones +","+cus.phone5;
                    }else {
                        phones = cus.phone5;
                    }
                }
                return phones;
            },
            lookWechat(val){
                clueVM.repeatCustomer = {};
                clueVM.repeatWechatVisible =true;
                clueVM.repeatCustomer = val;
            },
            telemarketingLayoutProjectIsShow(category){
                if((telemarketingLayout &&  (','+telemarketingLayout.category+',').indexOf(','+category+',') != -1 && telemarketingLayout.projectShow ==1) || roleCode =="GLY"){
                    return true;
                }
                return false;
            },
            telemarketingLayoutSourceIsShow(category){
                if((telemarketingLayout &&  (','+telemarketingLayout.category+',').indexOf(','+category+',') != -1 && telemarketingLayout.sourceShow ==1) || roleCode =="GLY"){
                    return true;
                }
                return false;
            },

        },
        created(){
            console.info("create method");
            // 进入页面判断有是否有存储值
            if(!this.paginationShow){
                var storeVal = getSessionStore("pendingAllocationManagerStoreForm");
                var otherVal = getSessionStore("pendingAllocationManagerOtherVal");
                if(storeVal && otherVal){
                    this.clueSearchForm = storeVal;
                    this.$set(this.pager,"currentPage",otherVal.currentPage);
                    this.storeId = otherVal.clueId;
                    this.scrollTop = otherVal.scrollTop;
                }
            };
            // 取页数存储
            var localVal=localStorage.getItem('allChangePageSize')?parseInt(localStorage.getItem('allChangePageSize')):'';
            if(localVal){this.pager.pageSize = localVal;}
            if(ownOrgId){this.isDXZDisabled= true;}//电销总监电销组筛选按钮不可点击
            this.initColumn();
            this.searchTable();
            // 除1、5、6、10、11、12、13业务线之外不可复制
            // if(businessLine!=1&&businessLine!=5&&businessLine!=6&&businessLine!=10&&businessLine!=11&&businessLine!=12&&businessLine!=13){
            if(canCopy!=true){
                document.getElementsByTagName('body')[0].className = 'noCopy'; //设置为新的
            }

        },//created方法 结束
        mounted(){
            document.getElementById('clueManage').style.display = 'block';
        }
    })

</script>
</html>